<template>
<el-dialog title="详细信息" :visible.sync="accountsVisable" append-to-body>
    <el-table
      :data="tableData"
      style="width: 100%"
      border
      show-overflow-tooltip
    >
    <el-table-column
      prop="sellerName"
      label="商家">
      </el-table-column>

    <el-table-column
      prop="typs"
      label="类型"
    >
     <template slot-scope="scope">
       <span v-if="scope.row.payType==11">返佣</span>
        <span v-if="scope.row.payType!=11">{{scope.row.typs}}</span>
     </template>

    </el-table-column>
      <el-table-column
        prop="sysNo"
        label="单号"
        show-overflow-tooltip
      >
        <!-- <template slot-scope="scope">
          {{scope.row[payTypeMap[scope.row.payType][3]]}}
        </template> -->
      </el-table-column>
      <el-table-column
        prop="banks"
        label="房间号"
      >
      </el-table-column>
      <el-table-column
        prop="payType"
        label="项目名称"
      > <template slot-scope="scope">
 {{payTypeMap[scope.row.payType][0]}}
        </template>

      </el-table-column>
      <el-table-column
        prop="consumeInfo"
        label="付款方式"
      >
      </el-table-column>
      <el-table-column
        prop="payPrice"
        label="金额"
      >
        <template slot-scope="scope">
          <el-tag :type="payTypeMap[scope.row.payType][1]">
            {{payTypeMap[scope.row.payType][2]+scope.row.payPrice}}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column
        prop="creatTime"
        label="发生时间"
        width="100px"

      >
      </el-table-column>
      <el-table-column
        prop="turnPeopleId"
        label="转账账号"
        show-overflow-tooltip
      >
      </el-table-column>
      <el-table-column
        prop="remarks"
        label="备注"
      >
      </el-table-column>
      <el-table-column
        prop="banksNumber"
        label="操作员"
      >
      </el-table-column>
  </el-table>
      <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[5,10, 20, 50, 100]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper"
    ></el-pagination>
</el-dialog>

</template>

<script>
  export default {
    data() {
      return {
        accountsVisable:false,
        tableData: [],
        payTypeMap: {
            0: ['预收款账', 'success', '', 'ruSysNo'],
            1: ['信用卡授权', 'success', '', 'ruSysNo'],
            2: ['消费', 'success', '', 'ruSysNo'],
            4: ['房费', 'success', '', 'ruSysNo'],
            5: ['预收退款', 'danger', '-', 'refundNo'],
            6: ['结账收款', 'success', '', 'ruSysNo'],
            7: ['结账退款', 'danger', '-', 'refundNo'],
            3: ['押金收款', 'success', '', 'ruSysNo'],
            8: ['押金退款', 'danger', '-', 'refundNo'],
            9: ['红冲', 'danger', '-', 'refundNo'],
            11: ['返佣', 'danger', '-', 'refundNo'],
            13: ['优惠金额', 'danger', '-', 'refundNo']
        },
        totalPage:0,
        pageIndex : 1,
        pageSize : 5,
        type:'',
        nowType:'',
        startTime:'',
        endTime:''
      }
    },
    methods:{
        init(type,nowType,startTime,endTime) {

            this.accountsVisable = true
            this.type = type
            this.nowType = nowType
            this.startTime = startTime
            this.endTime = endTime
            this.pageSize = 5
            this.pageIndex = 1
            this.getData(type,nowType,startTime,endTime);
        },

        getData(type,nowType,startTime,endTime) {
          this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroomcheckinaccounting/getByTypeAndTimeWithShiftWork'),
          method: 'get',
          params: this.$http.adornParams({
            page: this.pageIndex,
            limit: this.pageSize,
            payType: this.type,
            nowType: this.nowType,
            startTime: this.startTime,
            endTime: this.endTime
          })
        }).then(({ data }) => {
          if (data && data.code === 0) {
            console.log(data)
            this.tableData = data.page.records
            this.totalPage = data.page.total;
          } else {

          }
        })
      },
      // 每页数
    sizeChangeHandle (val) {
      this.pageSize = val;
      this.pageIndex = 1;
      this.getData();
    },
    // 当前页
    currentChangeHandle (val) {
      this.pageIndex = val;
      this.getData();
    }
    }
  }
</script>
